package com.cy.personer.web;
import com.cy.personer.bean.Item;
import com.cy.personer.biz.ItemBiz;
import com.cy.personer.util.ImportExcelUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.List;

@Controller
@RequestMapping("/item")
public class ItemHandler {
    @Resource
   private ItemBiz itemBizIpml;

    /**
     * 查询所有项目列表，包含条件查询，分页
     * @author peipei
     */
    @RequestMapping(value = "/findAllItem.action", method=RequestMethod.POST, produces="application/json;charset=utf-8" )
    public @ResponseBody PageInfo<Item>  findAllItem(int pageNum, int pageSize, Item item){
        return itemBizIpml.findAllItem(item,pageNum,pageSize);
    }
    /**
     * 添加项目
     * @author peipei
     */
    @RequestMapping(value = "/addItem.action",method=RequestMethod.POST,produces = "text/html;charset=utf-8")
    public @ResponseBody String addItem(Item item){
      int i=  itemBizIpml.addItem(item);
      if(i>0){
          return "success";
      }else{
            return "error";
        }
    }




}
